/**
 * 
 * @param {import('express').Request} req 
 */
exports.promise = (req) => new Promise((resolve, reject) => {
    let body = ''
    req.on('data', chunk => body += chunk)
    req.on('end', () => resolve(body))
    req.on('error', reject)
})

/**
 * 
 * @param {import('express').Request} req 
 */
exports.callback = (req, callback = () => {}) => {
    let body = ''
    req.on('data', chunk => body += chunk)
    req.on('end', () => callback(body))
    req.on('error', err => callback(false, err))
}